<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<title>衣服</title>
		<%@include file="/common/header.jsp" %>
		<link rel="stylesheet" href="${basePath }css/clothes.css">
		
	</head>
	<body>
		<%@include file="/common/top.jsp" %>	
	
		<div class="_catelog">
			<ul class="nav nav-pills">
				<s:iterator value="categoryList">
					<s:if test="category.id == id"><li class="active"></s:if>
					<s:else><li></s:else>
						<a href="${basePath }good_toShoesUI.action?pcategory.id=shoes01&category.id=<s:property value="id"/>"><s:property value="name"/></a>
					</li>
				</s:iterator>			    
	        </ul>
        </div>
			
		<form>
			<div class="_detail">
				<div class="_detail_good">
					<s:hidden id="pid" name="pcategory.id"></s:hidden>
					<s:hidden id="cid" name="category.id"></s:hidden>
					<s:hidden id="goodId" name="good.id"></s:hidden>
					<div class="_detail_good_img">
						<img src="${basePath }img/goods/<s:property value="good.img" />" />
					</div>
					<div class="_detail_good_text">
						<div class="_detail_good_name">
							商品名称:<span><s:property value="good.name" /></span>
						</div>
						<div class="_detail_good_price">
							价钱:&nbsp;&nbsp;<span>¥ <s:property value="good.price" /></span>
						</div>
						<div class="_detail_good_description">
							商品描述:&nbsp;&nbsp;<span><s:property value="good.description" /></span>
						</div>
						<div class="_detail_good_price">
							<p>产地:&nbsp;&nbsp;<s:property value="good.place" /></p>
						</div>
						<div class="_detail_good_number">
							<div class="_detail_good_number_l">
							数量:&nbsp;&nbsp;<input id="number" type="text" value="1"/>
							</div>
							<div class="_detail_good_number_operation">
								<div class="_detail_good_number_operation_add">&nbsp;+</div>
								<div class="_detail_good_number_operation_subtract">&nbsp;-</div>
							</div>
							<div class="_detail_good_inventory">
								&nbsp;&nbsp;库存:9999
							</div>
						</div>
						
						<div class="_detail_good_btn_car">
							<input class="_addCar" type="button" value="加入购物车" onclick="addCar()">
							<input class="_return" type="button" value="返回" onclick="history.go(-1)"/>
						</div>
							
					</div>
				</div>
			</div>
		</form>
		
		<%@include file="/common/footer.jsp" %>
		
		
		<script>
			$('._detail_good_number_operation_add').click(function(){
				var num = $('#number').val();
				num++;
				$('#number').val(num);
			});
			$('._detail_good_number_operation_subtract').click(function(){
				var num = $('#number').val();
				num--;
				if(num<1){
					alert('至少为1件');
					return false;
				}
				$('#number').val(num);
			});

			//加入购物车,先校验
			function addCar(){
				var number = $('#number').val();
				if(number < 1){
					alert('至少购买一件');
					return false;
				}
				var goodId = $('#goodId').val();	
				var pid = $('#pid').val();
				var cid = $('#cid').val();
				window.location = "${basePath }good_addCar.action?pcategory.id="+pid+"&category.id="+cid+"&good.id="+goodId+"&number="+number;
			}
		</script>
	</body>
</html>
